
<html>
<body >
<h1>Listado de los libros actuales</h1> </br></br>
<%
Dim Conn, Rs, sql, criteria, value

' A Function to check if some field entered by user is empty
Function ChkString(string)
	If string = "" Then string = " "
	ChkString = Replace(string, "'", "''")
End Function

criteria = ChkString(Request.Form("criteria"))
value = ChkString(Request.Form("value"))

Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conn.Open "Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Port=3306; Database=redes; UID=root; PWD="
sql= "SELECT * FROM libros WHERE "&criteria&" LIKE ""%"&value&"%"";"
Rs.Open sql, Conn
Response.Write "<FORM name='Update' method='post' action='toUpdateT.asp'>"
Response.Write "<table border=1 cellspacing=0>"

Response.Write "<tr>"&"<th align='center'>"&"Titulo"&"</th>"&"<th align='center'>"&"Autor"&"</th>"&"<th align='center'>"&"Editorial"&"</th>"&"<th align='center'>"&"Detalle"&"</th>"&"<th align='center'>"&"ISBN"&"</th>"&"<th align='center'>"&"Precio"&"</th>"&"</tr>"
if NOT Rs.EOF then
Do While not Rs.EOF
    Response.Write ("<tr>")
    Response.Write ("<td><a href=""viewBook.asp?ISBN="&Rs("ISBN")&""">"&Rs("Titulo")&"</a></td>")
    Response.Write ("<td>"&Rs("Autor")&"</td>")
    Response.Write ("<td>"&Rs("Editorial")&"</td>")
    Response.Write ("<td>"&Rs("Detalle")&"</td>")
    Response.Write ("<td>"&Rs("ISBN")&"</td>")
    Response.Write ("<td>"&Rs("Precio")&"</td>")
    Response.Write ("</tr>")
    Rs.MoveNext
Loop
else
   Response.Write("No records found")
end if
Response.Write "</table>"
Rs.Close
Set Rs = Nothing
Set Conn = Nothing
%>
</form>
</body>
</html> 



